import request from '@/utils/request'

type Common<T> = {
  code: string
  data: T
  mesg: string
  time: string
}
export type QueryResult = {
  current: number
  hitCount?: boolean
  optimizeCountSql?: true
  orders?: any[]
  pages: number
  records: Resource[] | []
  searchCount?: boolean
  size: number
  total: number
}
type Resource = {
  categoryId: number
  createdBy: string
  createdTime: string
  description: string
  id: number
  name: string
  operatorId: number | null
  selected: boolean
  updatedBy: string
  updatedTime: string
  url: string
}

export type QueryCondition = Partial<{
  id: number
  name: string
  startCreateTime: string
  url: string
  categoryId: number
  endCreateTime: string
  current: number
  size: number
}>


//获取所有资源信息
export const getResourcePages = (condition: QueryCondition) => {
  return request<Common<QueryResult>>({
    method: 'POST',
    url: '/boss/resource/getResourcePages',
    data: condition
  })
}